void setup() {
       size(400, 400);
       background(192, 64, 0);
       stroke(255);
     }
         
     void draw() {
     }
     boolean press = true;
     float xStart, yStart, xEnd, yEnd;
     float m1,m2;

void mousePressed() {
  int stepX,stepY;
  if(press){
   xStart=mouseX;
   yStart=mouseY;
   press=false;
   point(xStart,yStart);
  }
  else{
   xEnd=mouseX;
   yEnd=mouseY;
   m1=(yEnd-yStart)/(xEnd-xStart);
   m2=(xEnd-xStart)/(yEnd-yStart);
    if (xEnd>=xStart){
     stepX=1;
    }else{
     stepX=-1;
    }
   if (yEnd>=yStart){
    stepY=1;
   }else{
    stepY=-1;
   }
  println(m1);

  if(m1>1||m1<-1){
   while(yStart!=yEnd){
    xStart=xStart+(m2*stepY);
    yStart=yStart+stepY;
    point(round(xStart),yStart);}
  }
  else{
   while(xStart!=xEnd){
    xStart=xStart+stepX;
    yStart=yStart+(m1*stepX);
    point(xStart,round(yStart));
   }
  }
 press=true;
 }   
}

